package com.cskaoyan.service.impl;

import com.cskaoyan.bean.vo.*;
import com.cskaoyan.mapper.CskaoyanmallOrderGoodsMapper;
import com.cskaoyan.mapper.CskaoyanmallOrderMapper;
import com.cskaoyan.mapper.CskaoyanmallUserMapper;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatServiceImpl implements StatService {
    @Autowired
    CskaoyanmallOrderMapper orderMapper;
    @Autowired
    CskaoyanmallOrderGoodsMapper orderGoodsMapper;
    @Autowired
    CskaoyanmallUserMapper userMapper;

    @Override
    public StatGoodsVO statGoods() {

        List<StatGoodsRows> rows = orderGoodsMapper.selectGoodsStat( );
        StatGoodsVO statGoodsVO = new StatGoodsVO( );
        statGoodsVO.setRows(rows);
        System.out.println(statGoodsVO);
        return statGoodsVO;

    }

    @Override
    public StatOrderVO statOrder() {
        List<StatOrderRows> rows = orderMapper.selectOrderStat( );
        StatOrderVO statOrderVO = new StatOrderVO( );
        statOrderVO.setRows(rows);
        return statOrderVO;
    }

    @Override
    public StatUserVO statUser() {
        Integer[] users = userMapper.selectUserStat( );
        StatUserVO statUserVO = new StatUserVO( );
        statUserVO.setUsers(users);
        return statUserVO;
    }
}
